package com.example.myapplication.Garbagesorting;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.example.myapplication.Config.TokenBean;
import com.example.myapplication.R;
import com.example.myapplication.ShuJu.GarbagesortingBean;
import com.google.gson.Gson;

public class CategorypageActivity extends AppCompatActivity {

    private ImageView img_ategorypage;
    private TextView title_categorypage;
    private TextView content_Categorypage;
    private Button but_Categorypage;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_categorypage);
        initview();
        //返回
        but_bloak();

    }

    private void but_bloak() {
        but_Categorypage.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                CategorypageActivity.this.finish();
            }
        });
    }

    private void initview() {
        Intent intent = getIntent();
        String garbagesortingBean = intent.getStringExtra("GarbagesortingBean");
        Gson gson = new Gson();
        GarbagesortingBean.RowsBean rowsBean = gson.fromJson(garbagesortingBean, GarbagesortingBean.RowsBean.class);

        img_ategorypage = findViewById(R.id.IMG_ategorypage);
        title_categorypage = findViewById(R.id.Title_Categorypage);
        content_Categorypage = findViewById(R.id.content_Categorypage);
        but_Categorypage = findViewById(R.id.but_Categorypage);

        Glide.with(CategorypageActivity.this).load(TokenBean.IP+rowsBean.getImgUrl()).into(img_ategorypage);
        title_categorypage.setText(rowsBean.getIntroduce());
        content_Categorypage.setText(rowsBean.getGuide());

    }
}